package com.info;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Hashtable;

public class FeatInfo implements InfoIf{
	
	private String name;
	private String description;
	
	private ArrayList<FeatInfo> featPreReq;
	
	private HashSet<FeatTypeEnum> featType;
	
	private String benefitText;
	private String normalText;
	private String specialText;
	private String source;
	
	
	private boolean isTeamwork;
	private boolean isCritical;
	private boolean isGrit;
	private boolean isStyle;
	private boolean isPerform;
	private boolean isRacial;
	private boolean isCompanion;
	private String raceName;
	
	private Hashtable<BonusTypeEnum, HashSet<ConditionalBonusInfo>> bonus;
	
	public FeatInfo(){
		bonus = new Hashtable<BonusTypeEnum, HashSet<ConditionalBonusInfo>>();
	}
	
	public String getBenefitText() {
		return benefitText;
	}

	public void setBenefitText(String benefitText) {
		this.benefitText = benefitText;
	}

	public String getNormalText() {
		return normalText;
	}

	public void setNormalText(String normalText) {
		this.normalText = normalText;
	}

	public String getSpecialText() {
		return specialText;
	}

	public void setSpecialText(String specialText) {
		this.specialText = specialText;
	}

	public String getSource() {
		return source;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public boolean isTeamwork() {
		return isTeamwork;
	}

	public void setTeamwork(boolean isTeamwork) {
		this.isTeamwork = isTeamwork;
	}

	public boolean isCritical() {
		return isCritical;
	}

	public void setCritical(boolean isCritical) {
		this.isCritical = isCritical;
	}

	public boolean isGrit() {
		return isGrit;
	}

	public void setGrit(boolean isGrit) {
		this.isGrit = isGrit;
	}

	public boolean isStyle() {
		return isStyle;
	}

	public void setStyle(boolean isStyle) {
		this.isStyle = isStyle;
	}

	public boolean isPerform() {
		return isPerform;
	}

	public void setPerform(boolean isPerform) {
		this.isPerform = isPerform;
	}

	public boolean isRacial() {
		return isRacial;
	}

	public void setRacial(boolean isRacial) {
		this.isRacial = isRacial;
	}

	public boolean isCompanion() {
		return isCompanion;
	}

	public void setCompanion(boolean isCompanion) {
		this.isCompanion = isCompanion;
	}

	public String getRaceName() {
		return raceName;
	}

	public void setRaceName(String raceName) {
		this.raceName = raceName;
	}

	public void addBonus(BonusTypeEnum type, HashSet<ConditionalBonusInfo> info){
		bonus.put(type, info);
	}

	public Hashtable<BonusTypeEnum, HashSet<ConditionalBonusInfo>> getBonus() {
		return bonus;
	}

	public void setBonus(Hashtable<BonusTypeEnum, HashSet<ConditionalBonusInfo>> bonus) {
		this.bonus = bonus;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public ArrayList<FeatInfo> getFeatPreReq() {
		return featPreReq;
	}

	public void setFeatPreReq(ArrayList<FeatInfo> featPreReq) {
		this.featPreReq = featPreReq;
	}

	public HashSet<FeatTypeEnum> getFeatType() {
		return featType;
	}

	public void setFeatType(HashSet<FeatTypeEnum> featType) {
		this.featType = featType;
	}

	@Override
	public String getName() {
		return name;
	}
	@Override
	public String getDescription() {
		return description;
	}
	@Override
	public BonusInfo getBonus(Object info, String condition) {
		if (bonus.containsKey(info)){
			HashSet<ConditionalBonusInfo> cI = bonus.get(info);
			for (ConditionalBonusInfo cInfo : cI){
				if (cInfo.getCondition() == null && condition != null){
					return BonusInfo.NO_BONUS;
				}else if (cInfo.getCondition() == null && condition == null){
					return cInfo;
				}else if (cInfo.getCondition().equals(condition)){
					return cInfo;
				}
			}
		}
		return BonusInfo.NO_BONUS;
	}
}
